import { defineStore } from "pinia"
import { ref } from 'vue'

// 定义用户身份密钥key的pinia
export const userKeyStore = defineStore('key', () => {
    //1.定义用户信息
    const key = ref({})
    //2.定义修改用户信息的方法
    const setKey = (newInfo) => {
        key.value = newInfo
    }
    //3.定义清空用户信息的方法
    const removeKey = () => {
        key.value = {}
    }

    return { key, setKey, removeKey }
}, {
    persist: true
})